'use strict';

/**
 * @ngdoc service
 * @name jgappApp.TaskStaticData
 * @description
 * # TaskStaticData
 * Service in the jgappApp.
 */
angular.module('jgappApp')
    .service('TaskStaticData', function() {
        var data = {
            statusList: [{
                key: "未开始",
                value: 1
            }, {
                key: "进行中",
                value: 2
            }, {
                key: "已完成",
                value: 3
            }],
            priorityList: [{
                value: 1,
                key: "普通"
            }, {
                value: 2,
                key: "紧急"
            }, {
                value: 3,
                key: "非常紧急"
            }],
            repetitionList: [{
                value: 0,
                key: "不重复"
            }, {
                value: 1,
                key: "每周重复"
            }, {
                value: 2,
                key: "每2周重复"
            }, {
                value: 3,
                key: "每月重复"
            }, {
                value: 4,
                key: "每3月重复"
            }],
            remindList: [{
                value: 0,
                key: "不提醒"
            }, {
                value: 1,
                key: "当天提醒"
            }, {
                value: 2,
                key: "提前一天"
            }, {
                value: 3,
                key: "提前三天"
            }, {
                value: 4,
                key: "提前五天"
            }],
            visibilityInPublicList: [{
                value: 0,
                key: "仅参与人可见"
            }, {
                value: 1,
                key: "所有人可见"
            }]
        };
        data.getContentBykey = function(value, type) {
            type = type + "List";
            var content;
            if (this[type]) {
                this[type].forEach(function(item, index) {
                    if (item.value == value) {
                        content = item.key;
                    }
                })
            }
            return content
        }
        return data
    });
